package com.clarte.productLine.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.clarte.common.dao.BaseDao;
import com.clarte.model.ProductLine;
@Service("productLineService")
@Transactional
public class ProductLineServiceImpl implements ProductLineService {
	@Resource(name="baseDao")
	private BaseDao<ProductLine, Integer> baseDao;
	@Override
	public void add(ProductLine obj) {
		baseDao.save(obj);
	}

	@Override
	public void del(Integer... id) {
		baseDao.delete(id);
	}

	@Override
	public void edit(ProductLine obj) {
		baseDao.update(obj);
	}

	@Override
	public List<ProductLine> findAll() {
		return baseDao.findAll();
	}

	@Override
	public boolean isExist(String code) {
		String hql = "select count(*) from ProductLine t where t.code=?";
		long l = baseDao.getTotal(hql, new String[]{code});
		return l > 0;
	}

}
